package com.igeek.oop.pojo;

/**
 * 电子门类：
 *  属性：门铃、开门关门的状态
 *
 */
public class ElectronicDoor {

    /**
     * 表示门铃：true -> 响了
     *          false -> 不响了
     */
    private boolean doorbell;

    /**
     * 表示开关：true -> 开
     *          false -> 关
     */
    private boolean isOn;

    public boolean isDoorbell() {
        return doorbell;
    }

    public void setDoorbell(boolean doorbell) {
        this.doorbell = doorbell;
    }

    public boolean isOn() {
        return isOn;
    }

    public void setOn(boolean on) {
        isOn = on;

        //开门之后，把门铃关掉
        this.setDoorbell(false);

        //打开5秒自动关闭
        try
        {
            Thread.sleep(1000);

            isOn = false;

        }catch(Exception e)
        {

        }
    }
}
